var submit = $("#submit");
submit.click(function () {
    var number = $("#user_number").val();
    var de = $(".delete");
    $.ajax({
        url:'/administrator/addUser',
        type:"GET",
        dataType:"JSON",
        data:{
            userName:number,
        },
        success:function (data) {
            if(data.msg.code==100){
                location.reload();
            }
        }
    });
    var de = $(".delete");
    for(var i=0;i<de.length;i++){
        $(de[i]).click(function () {
            var tr = $(this).parent().parent();
            tr.remove();
            var value = $(this).data('id');
            console.log(value);
            $.ajax({
                url:'/administrator/deleteUser',
                type:"GET",
                dataType:"JSON",
                data:{
                    userId:value
                },
                success:function(data){
                    if(data.msg.code==100){
                        location.reload();
                    }
                }
            });
        });
    }
});

//页面删除
var de = $(".delete");
for(var i=0;i<de.length;i++){
    $(de[i]).click(function () {
        var tr = $(this).parent().parent();
        tr.remove();
        var value = $(this).data('id');
        console.log(value);
        $.ajax({
            url:'/administrator/deleteUser',
            type:"GET",
            dataType:"JSON",
            data:{
                userId:value
            },
            success:function(data){
                if(data.msg.code==100){
                    location.reload();
                }
            }
        });
    });
}

